<template>
  <div style="width: 100%; height: 100%" ref="chartsDOMBar"></div>
</template>
<script>
import * as echarts from 'echarts'
import { getAction } from '@/api/manage'
export default {
  data() {
    return {
      dataList:[],
      dataInfo:[]
    }
  },
  created() {
  },
  mounted() {
    
  },
  methods: {
    ininMap(data) {
     let xData = []
     let data1 = []
     let data2 = []
     data.forEach((item,index) => {
        xData.push(item.years)
        data1.push(item.ys)
        data2.push(item.sj)
     });
      var myChart = echarts.init(this.$refs['chartsDOMBar'])
      myChart.showLoading()
      myChart.hideLoading()
      var option = {
        tooltip: {
            trigger: 'axis',
            formatter: function (params) {
                var relVal = params[0].name;
                for (var i = 0, l = params.length; i < l; i++) {
                    relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + ' 万元'
                }
                return relVal;
            }
        },
        legend: {
            data: ['营业收入', '上缴税金'],
            textStyle:{
                color:'#fff'
            }
        },
        xAxis: [
            {
                type: 'category',
                color:'#fff',
                data: xData,
                axisLine: {
                    lineStyle: {
                        color: "#fff",
                    },
                },
                axisTick: {
                    show: false // 隐藏X轴上的分割线
                },
                splitLine: {
                    show: false
                },

            }
        ],
        yAxis: [
            {
                type: 'value',
                axisLine: {
                    lineStyle: {
                        color: "#fff",
                    },
                },
                splitLine: {
                    show: false
                },
                axisTick: {
                    show: false // 隐藏y轴上的分割线
                }
            }
        ],
        grid:{
            top:30,
            right:20,
            left:80,
            bottom:30
        },
        series: [
            {
            name: '营业收入',
            type: 'bar',
            data: data1,
            itemStyle:{
                color:'#7a03ef'
            },
            tooltip: {
                valueFormatter: function (value) {
                    return value + ' 万元';
                }
            }

            },
            {
            name: '上缴税金',
            type: 'bar',
            data: data2,
            itemStyle:{
                color:'#1df9fc'
            },
            tooltip: {
                valueFormatter: function (value) {
                    return value + ' 万元';
                }
            }
            }
        ]
      }
      myChart.setOption(option)
    }
  },
}
</script>
<style lang="less" scoped>
</style>